package zpx.model;

/**
 * 分页信息封装对象
 * 
 * 
 * @author zhenhai.yang
 */
public class DataGridModel implements java.io.Serializable {

    private static final long  serialVersionUID = 7232798260610351343L;
    public static final String ASC              = "asc";
    public static final String DESC             = "desc";
    private int                page             = 0;                   // 当前�?,名字必须为page
    private int                rows             = -1;                  // 每页大小,名字必须为rows
    private String             sort;                                   // 排序字段
    private String             order;                                  // 排序规则

    public int getPage() {
        return page;
    }

    public void setPage(int page) {
        this.page = page;
    }

    public int getRows() {
        return rows;
    }

    public void setRows(int rows) {
        this.rows = rows;
    }

    public String getSort() {
        return sort;
    }

    public void setSort(String sort) {
        this.sort = sort;
    }

    public String getOrder() {
        return order;
    }

    public void setOrder(String order) {
        this.order = order;
    }

    /**
     * 获取hibernate�?索开始索�?
     * 
     * @return int
     */
    public int getFirst() {
        if ((this.page < 1) || (this.rows < 1)) {
            return 0;
        }
        return (this.page - 1) * this.rows;
    }

}
